/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui.impl;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui.AbstractPresentation;
import vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui.AbstractUIComponent;
import vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui.AdaptedauiPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Abstract Presentation</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link vn.edu.hcmus.fit.se.mdd.mbuid.adaptedaui.impl.AbstractPresentationImpl#getAbstractUIComponent <em>Abstract UI Component</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class AbstractPresentationImpl extends PresentationImpl implements AbstractPresentation {
	/**
	 * The cached value of the '{@link #getAbstractUIComponent() <em>Abstract UI Component</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getAbstractUIComponent()
	 * @generated
	 * @ordered
	 */
	protected AbstractUIComponent abstractUIComponent;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected AbstractPresentationImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return AdaptedauiPackage.Literals.ABSTRACT_PRESENTATION;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AbstractUIComponent getAbstractUIComponent() {
		return abstractUIComponent;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetAbstractUIComponent(AbstractUIComponent newAbstractUIComponent, NotificationChain msgs) {
		AbstractUIComponent oldAbstractUIComponent = abstractUIComponent;
		abstractUIComponent = newAbstractUIComponent;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AdaptedauiPackage.ABSTRACT_PRESENTATION__ABSTRACT_UI_COMPONENT, oldAbstractUIComponent, newAbstractUIComponent);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setAbstractUIComponent(AbstractUIComponent newAbstractUIComponent) {
		if (newAbstractUIComponent != abstractUIComponent) {
			NotificationChain msgs = null;
			if (abstractUIComponent != null)
				msgs = ((InternalEObject)abstractUIComponent).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AdaptedauiPackage.ABSTRACT_PRESENTATION__ABSTRACT_UI_COMPONENT, null, msgs);
			if (newAbstractUIComponent != null)
				msgs = ((InternalEObject)newAbstractUIComponent).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AdaptedauiPackage.ABSTRACT_PRESENTATION__ABSTRACT_UI_COMPONENT, null, msgs);
			msgs = basicSetAbstractUIComponent(newAbstractUIComponent, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, AdaptedauiPackage.ABSTRACT_PRESENTATION__ABSTRACT_UI_COMPONENT, newAbstractUIComponent, newAbstractUIComponent));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case AdaptedauiPackage.ABSTRACT_PRESENTATION__ABSTRACT_UI_COMPONENT:
				return basicSetAbstractUIComponent(null, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case AdaptedauiPackage.ABSTRACT_PRESENTATION__ABSTRACT_UI_COMPONENT:
				return getAbstractUIComponent();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case AdaptedauiPackage.ABSTRACT_PRESENTATION__ABSTRACT_UI_COMPONENT:
				setAbstractUIComponent((AbstractUIComponent)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case AdaptedauiPackage.ABSTRACT_PRESENTATION__ABSTRACT_UI_COMPONENT:
				setAbstractUIComponent((AbstractUIComponent)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case AdaptedauiPackage.ABSTRACT_PRESENTATION__ABSTRACT_UI_COMPONENT:
				return abstractUIComponent != null;
		}
		return super.eIsSet(featureID);
	}

} //AbstractPresentationImpl
